package FlowGram.Application.IDEWindow.FileManager;

import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @author thackray
 *
 */
public class ProjectFileItem extends File{
	
	protected List<CodeFileItem> codeFiles;
	protected List<TerrainFileItem> terrainFiles;
	
	public ProjectFileItem(String path){
		super(path);
		this.codeFiles = new ArrayList<CodeFileItem>();
		this.terrainFiles = new ArrayList<TerrainFileItem>();
	}
	
	public String getTerrainsPath(){
		File[] fs = this.listFiles(new FileFilter(){
			public boolean accept(File f){
				return (f.isDirectory() && f.getName().equals("terrains"));
			}
		});
		if(fs.length > 0){
			return fs[0].getPath();
		}
		return "";
	}
	public void addCodeFile(CodeFileItem item){
		this.codeFiles.add(item);
	}
	public List<CodeFileItem> getCodeFiles(){
		return this.codeFiles;
	}
	public void addTerrainFile(TerrainFileItem item){
		this.terrainFiles.add(item);
	}
	public List<TerrainFileItem> getTerrainFiles(){
		return this.terrainFiles;
	}
	public String toString(){
		return this.getName();
	}
}
